<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>基本演示</title>
</head>

<body>
    <style>
        .sticky {
            position: -webkit-sticky;
            position: sticky;
            top: 0;
            padding: 5px;
            background-color: #cae8ca;
            border: 2px solid #4CAF50;
        }

        .box {
            overflow: scroll;
            margin-top: 100px;
            width: 100%;
            height: 500px;
            background: #ff0;
        }

        .content {
            width: 100%;
            height: 800px;
            overflow: auto;
            background: #4CAF50;
        }
    </style>
    <div class="content">
        <div class="box">
            <p>测试数据</p>
            <p>注意: IE/Edge 15 及更早 IE 版本不支持 sticky 属性。</p>
            <div class="sticky">粘性定位!</div>
            <div style="padding-bottom:2000px">
                <p>测试</p>
                <p>测试</p>
                <p>测试</p>
                <p>测试</p>
            </div>
        </div>
    </div>
</body>

</html>